{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}

<td colspan="4" style="padding: 0;">
  <div class="udf-container">

    <h4>Edit UDF</h4>

    <form class="form-horizontal">
      <div class="form-group">
        <label class="col-sm-2 control-label">UDF Name</label>
        <div class="col-sm-10">
          {{input type="text" class="form-control" placeholder="UDF Name" value=name }}
        </div>
      </div>
      <div class="form-group">
        <label class="col-sm-2 control-label">UDF Class Name</label>
        <div class="col-sm-10">
          {{input type="text" class="form-control" placeholder="UDF Class Name" value=classname }}
        </div>
      </div>

      <div class="form-group">
        <label class="col-sm-2 control-label">File Resource</label>
        <div class="col-sm-10">
          {{#unless isAddingNewFileResource}}
            {{#power-select
            options=fileResourceList
            placeholder="File Resource"
            searchField="name"
            selected=selectedFileResource
            searchPlaceholder="Type the paramter"
            onchange=(action "handleResourceChange" ) as |filter| }}
              {{filter.name}}
            {{/power-select}}
          {{/unless}}
          {{#if isAddingNewFileResource}}

            <div class="form-group">
              <label class="col-sm-2 control-label">Resource name</label>
              <div class="col-sm-10">
                {{input type="text" class="form-control" placeholder="File Resource Name" value=udfFileResourceName }}
              </div>
            </div>

            <div class="form-group">
              <label class="col-sm-2 control-label">Resource Path</label>
              <div class="col-sm-10">
                {{input type="text" class="form-control" placeholder="File Resource path" value=udfFileResourcePath }}
              </div>
            </div>

          {{/if}}
        </div>
      </div>

      <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
          <button class="btn btn-success" type="button" {{action 'saveUDf' name classname udfid udfFileResourceName udfFileResourcePath}}>Save UDF</button>
          <button class="btn btn-warning" type="button" {{action 'cancelEditUdf'}}>Cancel</button>
        </div>
      </div>
    </form>


  </div>
</td>


{{yield}}
